{include file="public/header" /}
<div class="header">
	<span>企业(学校)列表</span>
	<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
		<i class="layui-icon layui-icon-add-1"></i>添加
	</button>
	<div></div>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>ID</th>
			<th>企业(学校)名</th>
			<th>联系人</th>
			<th>手机号</th>
			<th>证件</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{volist name="lists" id='vo'}
			<tr>
				<td>{$vo.school_id}</td>
				<td>{$vo.school_name}</td>
				<td>{$vo.name}</td>
				<td>{$vo.phone}</td>
				<td><img style="width:100px;height:100px;" src="{$config['admin_domain'].$vo['license']}" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()"></td>
				<td>
					{if($vo['status']==1)}
						开启
					{elseif($vo['status']==0)/}
						<span style="color:grey;">关闭</span>
					{elseif($vo['status']==2)/}
						<span style="color:red;">待审核</span>
					{elseif($vo['status']==9)/}
						<span style="color:grey;">删除</span>
					{/if}
				</td>
				<td>
					{if($vo['status'] != 9)}
						<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$vo.school_id})">
							<i class="layui-icon layui-icon-edit"></i>编辑
						</button>
						<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" onclick="del({$vo.school_id})">
							<i class="layui-icon layui-icon-delete"></i>删除
						</button>
					{/if}
				</td>
			</tr>
		{/volist}
	</tbody>
</table>
<script type="text/javascript">
	layui.use(['layer'],function(){
		layer = layui.layer;
		$ = layui.jquery;
	});
	// 添加
	function add(){
		layer.open({
			type: 2,
			title: '添加',
			shade: 0.3,
			area: ['650px','650px'],
			content: "{$config['admin_route']}oyk/school_add"
		});
	}
	// 编辑
	function edit(school_id){
		layer.open({
			type: 2,
			title: '编辑',
			shade: 0.3,
			area: ['650px','650px'],
			content: "{$config['admin_route']}oyk/school_edit?school_id="+school_id
		});
	}
	// 删除
	function del(school_id){
		layer.confirm('确定要删除吗？', {
			icon:3,
			btn: ['确定','取消']
		}, function(){
			$.post('{$config["admin_route"]}oyk/school_del',{'school_id':school_id},function(res){
				if(res.code>0){
					layer.alert(res.msg,{icon:2});
				}else{
					layer.msg(res.msg,{icon:1});
					setTimeout(function(){window.location.reload();},1000);
				}
			},'json');
		});
	}
</script>
{include file="public/tail" /}